<template>
  <div>
    <div>测试警告组件</div>
    <div>
      <div>
        <el-alert
          id="comm"
          style="display: none"
          :title="title"
          :type="type"
          :description="description"
        >
        </el-alert>
      </div>
      <div>
        <button @click="alert('success')">success</button>
        <button @click="alert('info')">info</button>
        <button @click="alert('warning')">warning</button>
        <button @click="alert('error')">error</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ElementUIAlert",
  data() {
    return {
      title: "",
      type: "",
      description: "",
    };
  },
  methods: {
    alert(type) {
      let comm = document.getElementById("comm");
      this.title = "标题"
      this.type = type
      this.description = "内容描述"
      comm.style.display = "block";
    },
  },
};
</script>

<style>
</style>
